package org.example;

import lombok.Builder;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@Data
@Builder(toBuilder = true)
public class Person {

    @NotNull
    private String name;
    @NotNull
    @Range(min = 10, max = 40)
    private Integer age;

    @Valid
    @NotNull
    @Size(min = 3, max = 5)
    private List<Child> childList;

    @Valid
    @NotNull
    private Child child;


}

@Data
@Builder(toBuilder = true)
class Child {
    @NotNull
    private String name;
}